﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using NUnit.Framework;
using WW.NActiveRecord.Internal;

namespace WW.NActiveRecord.Tests.StudyTest
{

    
    class TestGeneric
    {
        void xxx<T>(T t)
        {
            Console.WriteLine(Equals(t, default(T)));
        }
        public void testpass()
        {
            string s = null;
            xxx(s);
            

            Dictionary<string,string> froms=new Dictionary<string, string>();
            froms.Add("b", "bb");
            froms.Add("a", "aa");
            froms.Add("c", "cc");
            
            Debug2.Print(froms);

            //Dictionary<string, object> d = new Dictionary<string,string> {{"", ""}};
            System.Collections.Hashtable h=new Hashtable{{1,1}};
            //Func<string,object>[] f=new []{x=>1};
            //x(x=>new []{y=>"s",z=>""});
            Func<string,string> f=x=>"";
            //x(xx => new[] { f});

            typeof(Nullable<int>).GetGenericTypeDefinition().ShouldBe(typeof(Nullable<>));
            typeof(Nullable<int>).GetGenericArguments()[0].ShouldBe(typeof(int));

        }
        void x(Func<string,Func<string,string>[]> f){}
        
        public void TestSplit()
        {
            string[] s ="Products_AS_p".Split(new[]{"_AS_"},StringSplitOptions.RemoveEmptyEntries);
            s.Count().ShouldBe(2);

            s = "Products".Split(new[] { "_AS_" }, StringSplitOptions.RemoveEmptyEntries);
            s.Count().ShouldBe(1);

            System.Text.RegularExpressions.Regex
                .Split("Products_As_p", "_AS_", System.Text.RegularExpressions.RegexOptions.IgnoreCase).Count().ShouldBe(2);
            System.Text.RegularExpressions.Regex
                .Split("Products_As", "_AS_", System.Text.RegularExpressions.RegexOptions.IgnoreCase).Count().ShouldBe(1);
        }

        
    }
}
